#!/usr/bin/env python
# -*- coding:utf-8 -*-

# file:homework2_5.py
# author:wmf
# datetime:2021/4/4 22:53
# software: PyCharm
'''
this is function description
'''
# import module your need

#5  写函数，检查传入字典的每一个value长度，
# 如果大于2，那么仅保留前两个长度的内容，并将新内容返回给调用者;

def KeepTwo(dict1):
    dict2 = {}
    for key,value in dict1.items():
        if(len(value) > 2):
            value = value[0] + value[1]
            dict2[key] = value
    dict1.update(dict2)
    return dict1

dict1 = {'1':'hello','2':'world','3':'a','4':'what','5':'78'}

print(KeepTwo(dict1))

